<?php
/**
 *
 * User: final507
 * Date: 2020/7/17
 * Email: <final507@163.com>
 */
declare (strict_types = 1);
namespace app\demo\controller;


use app\BaseController;
use app\common\MyServiceDemo;
use think\Facade\Event;

class demo extends BaseController
{

    public function TestCache()
    {
//        Event::trigger('DemoLog');
//        \think\facade\Log::info('asdasda');
//        event('dl'); php think make:event \app\demo\event\TestA
//        $a = zend_loader_file_encoded();
//        halt($a);
//        halt($GLOBALS['__composer_autoload_files']);

//        $a =function (){
//            echo 1;
//        };
//        halt(date('H'));
//        apcu_store('Test','老王');
//        halt(apcu_fetch('Test'));
//        halt(method_exists(new \Closure,$a));
//        return json(['time'=>time()]);
        //触发事件

//        $people = array("Bill", "Steve", "Mark", "David");
//        return json(['people'=>$people]);
//        halt(reset($people));
    }
    public function testService(MyServiceDemo $demo){
        // 因为在服务提供类app\service\MyService的boot方法中设置了$myStaticVar=‘456’\
        // 所以这里输出'456'
//        $demo->showVar();
        echo '1';
//        $a = false;
//        if(!$a){
//            echo '1';
//        }else{
//            echo '2';
//        }
    }

    public function testServiceDi(){

        return (new  \app\demo\controller\FileDownload())->download('./PhpStorm-2020.1.3.exe','',true);
//        return download('./PhpStorm-2020.1.3.exe', 'PhpStorm.exe');
    }
}